import http from '@/http';

const url = '/api/UserSystem/activity';

// 活动管理 列表
export async function getActivityList(options = {}) {
  return await http.request('get', url, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 新增
export async function addActivity(options = {}) {
  return await http.request('post', url, options).then(res => {
    res.code == 200 && (res.message = '新增成功');
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 修改活动
export async function editActivity(id, options = {}) {
  return await http.request('put', `${ url }/${ id }`, options).then(res => {
    res.code == 200 && (res.message = '修改成功');
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 查看
export async function getActivityDetail(id, options = {}) {
  return await http.request('get', `${ url }/${ id }`, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 修改状态
export async function editActivityState(id, options = {}) {
  return await http.request('put', `${ url }/state/${ id }`, options).then(res => {
    res.code == 200 && (res.message = '修改成功');
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 贡献清单列表
export async function getContributionList(id, options = {}) {
  return await http.request('get', `${ url }/contribution/${ id }`, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 导出贡献清单
export async function contributionListExport(options = {}) {
  return await http.request('get', `${ url }/contributionExport`, options).then(res => {
    res.code == 200 && (res.message = '导出成功');
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 报名清单列表
export async function getApplyList(id, options = {}) {
  return await http.request('get', `${ url }/participation/${ id }`, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 活动管理 导出清单列表
export async function applyListExport(options = {}) {
  return await http.request('get', `${ url }/participationExport`, options).then(res => {
    res.code == 200 && (res.message = '导出成功');
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
